﻿// Copyright 2007-2008 Rory Plaire (codekaizen@gmail.com)

namespace NPack.Interfaces
{
    /// <summary>
    /// Every class that defines a - operation 
    /// like <c>TDifference operator - (ISubtractable`2 a, TSubtrahend b)</c> 
    /// should consider implementing this interface.
    /// </summary>
    /// <typeparam name="TSubtrahend">Type which subracts from this type.</typeparam>
    /// <typeparam name="TDifference">Type which is the result of subtraction.</typeparam>
    /// <remarks>
    /// Adapted from an article on lambda-computing.com: 
    /// http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs.
    /// </remarks>
    public interface ISubtractable<TSubtrahend, TDifference>
    {
        /// <summary>
        /// Returns the difference of the Object and <paramref name="b"/>.
        /// It must not modify the value of the Object.
        /// </summary>
        /// <param name="b">The second operand.</param>
        /// <returns>The difference.</returns>
        TDifference Subtract(TSubtrahend b);
    }
}
